<template>
	<div>
		<el-dialog title="运营商详情" :visible.sync="dialogTableVisible" width="930px">
			<r-showTable title="基础信息" :ListCols="baseInfoCols" :ListData="info" col="2" />
			<r-list title="财务信息" :ListCols="financialCols" :ListData="dataInfo" />
			<r-list title="运营角色信息" :ListCols="operatorInfo" :ListData="dataInfo" />
			<r-list title="设备信息" :ListCols="deviceInfo" :ListData="dataInfo" />
		</el-dialog>
	</div>
</template>
<script>
export default {
	data() {
		return {
			dialogTableVisible: false,
			info: {},
			dataInfo: {},
			baseInfoCols: [
				/* {
					type: 'image',
					thShow: e => false,
					rowspan: 4,
					prop: 'pic'
				}, */
				{
					label: '运营商名称',
					prop: 'name',
				},
				{
					label: '创建时间',
					prop: 'createdTime'
				},
				{
					label: '运营商地址',
					prop: 'address'
				},
				{
					label: '上次登录时间',
					prop: 'loginTime'
				},
				{
					label: '联系人',
					prop: 'contacts'
				},
				{
					label: '账号状态',
					prop: 'state',
					itemClass: e => (e.state == 1 ? 'primary' : ''),
					formatter: e => (e.state == 1 ? '启用' : e.state == 2 ? '禁用' : '--')
				},

				{
					label: '手机号',
					prop: 'phone'
				},
				{
					label: '登录账号',
					prop: 'account'
				},
				{
					label: '运营商业务',
					prop: 'operateHd',
					formatter: e =>{
						let text = ''
						
						if(e.operateHd == 1) {
							text += '换电、'
						}
						if(e.operateCd == 1) {
							text += '充电、'
						}
						if(e.operateZc == 1) {
							text += '租车'
						}
						
						if(text[text.length-1] == '、') {
							text = text.substr(0,text.length-1)
						}
						
						return text
					}
				},
				
			],
			financialCols: [
				[
					{
						label: '总订单数量',
						prop: 'totalCount'
					},
					{
						label: '充电订单数量',
						prop: 'chrCount'
					},
					{
						label: '租换电订单数量',
						prop: 'excCount'
					},
					{
						label: '租车订单数量',
						prop: 'carCount'
					},
					{
						label: '充值订单数量',
						prop: 'inCount'
					}
				],
				[
					{
						label: '订单总金额',
						prop: 'totalAmount'
					},
					{
						label: '充电订单总金额',
						prop: 'chrAmount'
					},
					{
						label: '租换电订单总金额',
						prop: 'excAmount'
					},
					{
						label: '租车订单总金额',
						prop: 'carAmount'
					},
					{
						label: '充值订单总金额',
						prop: 'inAmount'
					}
				],
				[
					{
						label: '订单总收益',
						prop: 'totalProfit'
					},
					{
						label: '充电订单总收益',
						prop: 'chrProfit'
					},
					{
						label: '租换电订单总收益',
						prop: 'excProfit'
					},
					{
						label: '租车订单总收益',
						prop: 'carProfit'
					},
					{
						label: '充值订单总收益',
						prop: 'inProfit'
					}
				]
			],
			operatorInfo: [
				[
					{
						label: '代理商数量',
						prop: 'agCount'
					},
					{
						label: '运维人员数量',
						prop: 'merCount'
					},
					{
						label: '站点数量',
						prop: 'siteNum'
					},
					{
						label: '用户数量',
						prop: 'userCount'
					},
				]
			],
			deviceInfo: [
				[
					{
						label: '充电柜数量',
						prop: 'chrNum'
					},
					{
						label: '换电柜数量',
						prop: 'excNum'
					},
					{
						label: '电动车数量',
						prop: 'carNum'
					},
					{
						label: '电池数量',
						prop: 'btNum'
					},
				]
			],
		}
	},
	created() {
		
	},
	mounted() {},
	methods: {
		async init(id) {
			if(this.id == id) {
				this.dialogTableVisible = true
				return false
			}
			this.id = id
			
			var res = await this.apis.operator_detail({
				id: id
			})
			
			this.dialogTableVisible = true
			this.info = res.data
			this.dataInfo = res.data.params
		
		}
	}
}
</script>
<style scoped lang="scss"></style>
